package com.search_wheel.pojo.dto;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

// AI响应实体
public class AiResponse {
    private String id;
    private String object;
    private long created;
    private String model;
    private List<Choice> choices;

    public static class Choice {
        private int index;
        private Message message;

        @JsonProperty("finish_reason")  // 这里是关键！API返回的是下划线格式
        private String finishReason;
        public static class Message {
            private String role;
            private String content;

            public String getRole() {
                return role;
            }

            public void setRole(String role) {
                this.role = role;
            }

            public String getContent() {
                return content;
            }

            public void setContent(String content) {
                this.content = content;
            }
        }
        // 添加Usage内部类来接收使用情况信息
        public static class Usage {
            @JsonProperty("prompt_tokens")
            private int promptTokens;

            @JsonProperty("completion_tokens")
            private int completionTokens;

            @JsonProperty("total_tokens")
            private int totalTokens;

            public int getPromptTokens() {
                return promptTokens;
            }

            public void setPromptTokens(int promptTokens) {
                this.promptTokens = promptTokens;
            }

            public int getCompletionTokens() {
                return completionTokens;
            }

            public void setCompletionTokens(int completionTokens) {
                this.completionTokens = completionTokens;
            }

            public int getTotalTokens() {
                return totalTokens;
            }

            public void setTotalTokens(int totalTokens) {
                this.totalTokens = totalTokens;
            }
        }


        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public Message getMessage() {
            return message;
        }

        public void setMessage(Message message) {
            this.message = message;
        }

        public String getFinishReason() {
            return finishReason;
        }

        public void setFinishReason(String finishReason) {
            this.finishReason = finishReason;
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getObject() {
        return object;
    }

    public void setObject(String object) {
        this.object = object;
    }

    public long getCreated() {
        return created;
    }

    public void setCreated(long created) {
        this.created = created;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public List<Choice> getChoices() {
        return choices;
    }

    public void setChoices(List<Choice> choices) {
        this.choices = choices;
    }
}
